#include "WaterShoot.h"


CWaterShoot::CWaterShoot()
{
	isDive = true;
	loadSprites();
}


CWaterShoot::~CWaterShoot()
{
	
}

CWaterShoot::CWaterShoot(D3DXVECTOR3 position)
{
	this->position_ = position;
	isDive = true;
	loadSprites();
}

void CWaterShoot::loadSprites()
{
	spriteVector_.push_back(new CSprite(L"Enemy//BOT4.png", 1, 2, 2));
}
void CWaterShoot::Update(DWORD deltaTime)
{

}
void CWaterShoot::AI(D3DXVECTOR3 playerPosition)
{ 
	static	DWORD timeShootForHide = 0;
	static	DWORD timeShoot = 0;
	DWORD now = 0;
	if (pow((playerPosition.y - this->getPosition().y), 2) <= 400 * 400) // Screen side
		isBeginShoot = true;
	else
		isBeginShoot = false;
	if (isBeginShoot)
	{
		if (isDive)
		{
			now = GetTickCount();
			if (now - timeShootForHide > 3000)
			{
				isDive = false;
				timeShoot = GetTickCount();
			}
		}
		else
		{
			now = GetTickCount();
			if (now - timeShoot > 2000)
				isDive = true;
			timeShootForHide = GetTickCount();
		}
	}
}

void CWaterShoot::Render()
{
	if (isBeginShoot)
	{
		if (isDive)
			spriteVector_[0]->Render(2, 2, this->position_);
		else
			spriteVector_[0]->Render(1, 2, this->position_);
	}
}

int CWaterShoot::HealthyState()
{
	return 0;
}

int CWaterShoot::setStatus()
{
	return 0;

}